﻿using System.Security.Cryptography.X509Certificates;
using System.ServiceModel;
using Microsoft.Commerce.Proxy.TransactionService.v201001;
using System;

namespace TestWebApplication.CommerceTransaction.APIs
{
    public class CommerceTransactionTestConnectionApi : CommerceTransactionApi
    {
        private string input;
        public string output;

        public CommerceTransactionTestConnectionApi(BasicHttpBinding binding, EndpointAddress address, X509Certificate2 clientCert,
               string input)
            : base(binding, address, clientCert)
        {

            this.input = input;
        }

        protected override AbstractResponse ExecuteInternal(TransactionServiceChannel channel)
        {
            
            Console.WriteLine(channel.LocalAddress);
            this.output = channel.TestConnection(this.input);

            return new AbstractResponse()
            {
                Ack = AckCodeType.Success,
            };
        }

        public override void PrepareRequestData()
        {
            
        }

        public override void PrepareResponseData()
        {


            return;
        }
    }
}
